<script>
    $(function() {
        $( "#tabs" ).tabs();    
        $('#next-1').button();
        $('#next-2').button();
        $('#next-3').button();
        $('#next-4').button();
        $('#next-5').button();
        
        $('#next-1').click(function() { 
            $( "#tabs" ).tabs('select', 1); 
            $("#frmConsultData").submit();
            return false;
        });
        $('#next-2').click(function() { 
            $( "#tabs" ).tabs('select', 2); 
            $("#frmConsultData").submit();
            return false;
        });
        $('#next-3').click(function() { 
            $( "#tabs" ).tabs('select', 3); 
            $("#frmConsultData").submit();
            return false;
        });
        $('#next-4').click(function() { 
            $( "#tabs" ).tabs('select', 4); 
            $("#frmConsultData").submit();
            return false;
        });
        $('#next-5').click(function() { 
            $( "#tabs" ).tabs('select', 5); 
            $("#frmConsultData").submit();
            return false;
        });
    });
                
    function calStrokeTime(){
        hh = $("input#strokeTimeHour").val();
        mm = $("input#strokeTimeMinute").val();

        hh = Number(hh) + Number(4);
        mm = Number(mm) + 30;
        if(mm > 60){
            mm = Number(mm) - 60;
            hh += 1;
        }

        var d = new Date();

        ch = d.getHours();
        cm = d.getMinutes();

        if(mm<cm){
            hh = Number(hh)-1;
            mm = Number(mm) + 60;
        }

        lh = Number(hh) - Number(ch);
        lm = Number(mm) - Number(cm);

        if(lh<0) {
            lh = 00;
            lm = 00;
        }
        
        $("div#strokeLeftHour").html(lh);
        $("div#strokeLeftMinute").html(lm);
    }

    function checkEstimate(id){                
        if($('input#'+id).is(':checked')){
            $('input#'+id).css('background-color','white');
        }else{
            $('input#'+id).css('background-color','red');
        }
    }

    function onchange_nihss()
    {
        no1a=$("select#no1a").val();
        no1b=$("select#no1b").val();
        no1c=$("select#no1c").val();
        no2=$("select#no2").val();
        no3=$("select#no3").val();
        no4=$("select#no4").val();
        no5a=$("select#no5a").val();
        no5b=$("select#no5b").val();
        no6a=$("select#no6a").val();
        no6b=$("select#no6b").val();
        no7=$("select#no7").val();
        no8=$("select#no8").val();
        no9=$("select#no9").val();
        no10=$("select#no10").val();
        no11=$("select#no11").val();
        total = Number(no1a) + Number(no1b) + Number(no1c) + Number(no2) +
                Number(no3) + Number(no4) + Number(no5a) + Number(no5b) +
                Number(no6a) + Number(no6b)+ Number(no7) + Number(no8) +
                Number(no9) + Number(no10) + Number(no11);
        $("div#nihss_score").html(total);
    }

    function checkBP(){
        BPmax = $('input#BPmax').val();
        BPmin = $('input#BPmin').val();
        if(BPmax>185){
            $('input#BPmax').css('border-color','red');
            $('input#BPmax').css('color','red');
        }else{
            $('input#BPmax').css('border-color','blue');
            $('input#BPmax').css('color','blue');
        }
    }

    function checkPG(){
        pg = $('input#BloodPG').val();
        if(pg>50 && pg<400){
            $('input[name=BloodPGYN]').attr('checked', true);
            $('#td_BloodPGYN').attr('bgcolor','');
        }else{
            $('input[name=BloodPGYN]').attr('checked', false);
            $('#td_BloodPGYN').attr('bgcolor','red');
        }
    }

     function checkPLT(){
        plt = $('input#BloodPLT').val();
        if(plt>100000){
            $('input[name=BloodPLTYN]').attr('checked', true);
            $('#td_BloodPLTYN').attr('bgcolor','');
        }else{
            $('input[name=BloodPLTYN]').attr('checked', false);
            $('#td_BloodPLTYN').attr('bgcolor','red');
        }
    }

    function nihss_start(){
               
        if($("#nihss_start_btn").val()=="Start"){
            url = "../ajax/nihssStart"
            isStart = true;            
            $("#nihss_start_btn").attr("value", "End");
        }else{
            url = "../ajax/nihssEnd"
            isStart = false;            
            $("#nihss_start_btn").attr("value", "Start");
        }

        $.ajax({
            type: "POST",
            url: url,
            data: {
                p_id:$("input#p_id").val(),
                c_id:$("input#c_id").val()
            },
            dataType: "html",
            success: function(data) {
               $('#nihss_start_div').html(data);
            }
            });
        

        $("select#no1a").attr("disabled", !isStart);
        $("select#no1b").attr("disabled", !isStart);
        $("select#no1c").attr("disabled", !isStart);
        $("select#no2").attr("disabled", !isStart);
        $("select#no3").attr("disabled", !isStart);
        $("select#no4").attr("disabled", !isStart);
        $("select#no5a").attr("disabled", !isStart);
        $("select#no5b").attr("disabled", !isStart);
        $("select#no6a").attr("disabled", !isStart);
        $("select#no6b").attr("disabled", !isStart);
        $("select#no7").attr("disabled", !isStart);
        $("select#no8").attr("disabled", !isStart);
        $("select#no9").attr("disabled", !isStart);
        $("select#no10").attr("disabled", !isStart);
        $("select#no11").attr("disabled", !isStart);
    }
</script>

<form id="frmConsultData" action="">
    <input type="hidden" id="c_id" name="c_id" value="<?php echo $c_id ?>">
    <input type="hidden" id="p_id" name="p_id" value="<?php echo $p_id ?>">
    <input type="hidden" id="method" name="method" value="save">
    <table width="100%" style="background-color: #eeeeee;">
        <tr>
            <td height="60" width="150" valign="middle">
                <div id="result" align="right">
                    <input class='ui-button ui-widget ui-state-default ui-corner-all' type="submit" value="บันทึก">&nbsp;&nbsp;
                </div>
            </td>
            <td align="left" valign="middle">
                    <input id="endConsultBtn" class='ui-button ui-widget ui-state-default ui-corner-all' type="button" value='สิ้นสุดการตรวจ'>
            </td>
            <td align="right">
                <table width="200" style="border: 1px solid black;background-color: white">
                    <tr>
                        <td width="40" align="center"><div style="color: red;" id="strokeLeftHour">00</div> </td><td>ชั่วโมง</td>
                        <td width="40" align="center"> <div style="color: red;" id="strokeLeftMinute">00</div></td><td>นาที</td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table width="100%" class="ui-widget ui-widget-content" style="background-color: #eeeeee;">
        <tr>
            <td align="left" valign="top" style="padding: 10px">
                <div id="tabs">
                    <ul>
                        <li><a href="#tabs-1" style="font-size: 12px">NIHSS</a></li>
                        <li><a href="#tabs-2" style="font-size: 12px">Stroke Data</a></li>
                        <li><a href="#tabs-3" style="font-size: 12px">Stroke Physical </a></li>
                        <li><a href="#tabs-4" style="font-size: 12px">Laboratory Screen</a></li>
                        <li><a href="#tabs-5" style="font-size: 12px">ประเมินทางประสาทวิทยา</a></li>
                        <li><a href="#tabs-6" style="font-size: 12px">Management</a></li>
                        <li><a href="#tabs-7" style="font-size: 12px">ข้อมูลคนไข้</a></li>

                    </ul>

                    <div id="tabs-1">
                        <table class="ui-widget ui-widget-content ui-corner-all">
                            <tr>
                                <td><div class="ui-state-highlight ui-corner-all" id="nihss_start_div" align="right"></div></td><td><input id="nihss_start_btn" type="button" onclick="nihss_start()" class='ui-button ui-widget ui-state-default ui-corner-all' value="Start"></td>
                            </tr>
                            <tr>
                                <td valign="top"> 1a. Level of consciousness </td>
                                <td style="padding-left: 5px">
                                    <select name="no1a" id="no1a" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no1a'])? ($nihss['no1a'] == 0? "selected": "") : "" ?>>Alert (0)</option>
                                        <option value="1" <?php echo isset($nihss['no1a'])? ($nihss['no1a'] == 1? "selected": "") : "" ?>>Drowsy (1)</option>
                                        <option value="2" <?php echo isset($nihss['no1a'])? ($nihss['no1a'] == 2? "selected": "") : "" ?>>Stuporous (2)</option>
                                        <option value="3" <?php echo isset($nihss['no1a'])? ($nihss['no1a'] == 3? "selected": "") : "" ?>>Coma (3)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 1b. Two questions ถามอายุและเดือน </td>
                                <td style="padding-left: 5px">
                                    <select name="no1b" id="no1b" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no1b'])? ($nihss['no1b'] == 0? "selected": "") : "" ?>>Both correct (0)</option>
                                        <option value="1" <?php echo isset($nihss['no1b'])? ($nihss['no1b'] == 1? "selected": "") : "" ?>>One correct (1)</option>
                                        <option value="2" <?php echo isset($nihss['no1b'])? ($nihss['no1b'] == 2? "selected": "") : "" ?>>None correct (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 1c. Two commands หลับตา ลืมตาและกำมือ แบมือ  </td>
                                <td style="padding-left: 5px">
                                    <select name="no1c" id="no1c" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no1c'])? ($nihss['no1c'] == 0? "selected": "") : "" ?>>Obeys both (0)</option>
                                        <option value="1" <?php echo isset($nihss['no1c'])? ($nihss['no1c'] == 1? "selected": "") : "" ?>>Obeys none (1)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 2. Best gaze มองด้านข้าง  </td>
                                <td style="padding-left: 5px">
                                    <select name="no2" id="no2" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no2'])? ($nihss['no2'] == 0? "selected": "") : "" ?>>Normal (0)</option>
                                        <option value="1" <?php echo isset($nihss['no2'])? ($nihss['no2'] == 1? "selected": "") : "" ?>>Partial gaze palsy (1)</option>
                                        <option value="2" <?php echo isset($nihss['no2'])? ($nihss['no2'] == 2? "selected": "") : "" ?>>Forced deviation (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 3. Best visual (visual field)</td>
                                <td style="padding-left: 5px">
                                    <select name="no3" id="no3" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no3'])? ($nihss['no3'] == 0? "selected": "") : "" ?>>No visual loss (0)</option>
                                        <option value="1" <?php echo isset($nihss['no3'])? ($nihss['no3'] == 1? "selected": "") : "" ?>>Partial hemianopia (1)</option>
                                        <option value="2" <?php echo isset($nihss['no3'])? ($nihss['no3'] == 2? "selected": "") : "" ?>>Complete  hemianopia (2)</option>
                                        <option value="3" <?php echo isset($nihss['no3'])? ($nihss['no3'] == 3? "selected": "") : "" ?>>Bilateral hemianopia (3)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 4. Facial palsy</td>
                                <td style="padding-left: 5px">
                                    <select name="no4" id="no4" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no4'])? ($nihss['no4'] == 0? "selected": "") : "" ?>>Normal (0)</option>
                                        <option value="1" <?php echo isset($nihss['no4'])? ($nihss['no4'] == 1? "selected": "") : "" ?>>Minor (1)</option>
                                        <option value="2" <?php echo isset($nihss['no4'])? ($nihss['no4'] == 2? "selected": "") : "" ?>>Partial (2)</option>
                                        <option value="3" <?php echo isset($nihss['no4'])? ($nihss['no4'] == 3? "selected": "") : "" ?>>Complete (3)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 5a. Best Motor Lt arms นั่งยกแขน 90 องศา 10 วินาทีหรือนอนยกแขน 45 องศา</td>
                                <td style="padding-left: 5px">
                                    <select name="no5a" id="no5a" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no5a'])? ($nihss['no5a'] == 0? "selected": "") : "" ?>>No drift (0)</option>
                                        <option value="1" <?php echo isset($nihss['no5a'])? ($nihss['no5a'] == 1? "selected": "") : "" ?>>Drift (1)</option>
                                        <option value="2" <?php echo isset($nihss['no5a'])? ($nihss['no5a'] == 2? "selected": "") : "" ?>>Fall in 10 secs (2)</option>
                                        <option value="3" <?php echo isset($nihss['no5a'])? ($nihss['no5a'] == 3? "selected": "") : "" ?>>No effort against gravity (3)</option>
                                        <option value="4" <?php echo isset($nihss['no5a'])? ($nihss['no5a'] == 4? "selected": "") : "" ?>>No movement (4)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 5b. Best Motor Rt arms นั่งยกแขน 90 องศา 10 วินาทีหรือนอนยกแขน 45 องศา</td>
                                <td style="padding-left: 5px">
                                    <select name="no5b" id="no5b" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no5b'])? ($nihss['no5b'] == 0? "selected": "") : "" ?>>No drift (0)</option>
                                        <option value="1" <?php echo isset($nihss['no5b'])? ($nihss['no5b'] == 1? "selected": "") : "" ?>>Drift (1)</option>
                                        <option value="2" <?php echo isset($nihss['no5b'])? ($nihss['no5b'] == 2? "selected": "") : "" ?>>Fall in 10 secs (2)</option>
                                        <option value="3" <?php echo isset($nihss['no5b'])? ($nihss['no5b'] == 3? "selected": "") : "" ?>>No effort against gravity (3)</option>
                                        <option value="4" <?php echo isset($nihss['no5b'])? ($nihss['no5b'] == 4? "selected": "") : "" ?>>No movement (4)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 6a. Best Motor Lt legs นอนยกขา 30 องศา 5 วินาที </td>
                                <td style="padding-left: 5px">
                                    <select name="no6a" id="no6a" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no6a'])? ($nihss['no6a'] == 0? "selected": "") : "" ?>>No drift (0)</option>
                                        <option value="1" <?php echo isset($nihss['no6a'])? ($nihss['no6a'] == 1? "selected": "") : "" ?>>Drift (1)</option>
                                        <option value="2" <?php echo isset($nihss['no6a'])? ($nihss['no6a'] == 2? "selected": "") : "" ?>>Fall in 10 secs (2)</option>
                                        <option value="3" <?php echo isset($nihss['no6a'])? ($nihss['no6a'] == 3? "selected": "") : "" ?>>No effort against gravity (3)</option>
                                        <option value="4" <?php echo isset($nihss['no6a'])? ($nihss['no6a'] == 4? "selected": "") : "" ?>>No movement (4)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 6b. Best Motor Rt legs นอนยกขา 30 องศา 5 วินาที </td>
                                <td style="padding-left: 5px">
                                    <select name="no6b" id="no6b" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no6b'])? ($nihss['no6b'] == 0? "selected": "") : "" ?>>No drift (0)</option>
                                        <option value="1" <?php echo isset($nihss['no6b'])? ($nihss['no6b'] == 1? "selected": "") : "" ?>>Drift (1)</option>
                                        <option value="2" <?php echo isset($nihss['no6b'])? ($nihss['no6b'] == 2? "selected": "") : "" ?>>Fall in 10 secs (2)</option>
                                        <option value="3" <?php echo isset($nihss['no6b'])? ($nihss['no6b'] == 3? "selected": "") : "" ?>>No effort against gravity (3)</option>
                                        <option value="4" <?php echo isset($nihss['no6b'])? ($nihss['no6b'] == 4? "selected": "") : "" ?>>No movement (4)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 7. Limb Ataxia </td>
                                <td style="padding-left: 5px">
                                    <select name="no7" id="no7" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no7'])? ($nihss['no7'] == 0? "selected": "") : "" ?>>Absent (0)</option>
                                        <option value="1" <?php echo isset($nihss['no7'])? ($nihss['no7'] == 1? "selected": "") : "" ?>>Upper or lower limb (1)</option>
                                        <option value="2" <?php echo isset($nihss['no7'])? ($nihss['no7'] == 2? "selected": "") : "" ?>>Upper & lower limb (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 8. Sensory </td>
                                <td style="padding-left: 5px">
                                    <select name="no8" id="no8" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no8'])? ($nihss['no8'] == 0? "selected": "") : "" ?>>Normal (0)</option>
                                        <option value="1" <?php echo isset($nihss['no8'])? ($nihss['no8'] == 1? "selected": "") : "" ?>>Partial loss (1)</option>
                                        <option value="2" <?php echo isset($nihss['no8'])? ($nihss['no8'] == 2? "selected": "") : "" ?>>Dense loss (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 9. Best language Aphasia </td>
                                <td style="padding-left: 5px">
                                    <select name="no9" id="no9" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no9'])? ($nihss['no9'] == 0? "selected": "") : "" ?>>No aphasia (0)</option>
                                        <option value="1" <?php echo isset($nihss['no9'])? ($nihss['no9'] == 1? "selected": "") : "" ?>>Mild to moderate (1)</option>
                                        <option value="2" <?php echo isset($nihss['no9'])? ($nihss['no9'] == 2? "selected": "") : "" ?>>Severe (2)</option>
                                        <option value="3" <?php echo isset($nihss['no9'])? ($nihss['no9'] == 3? "selected": "") : "" ?>>Mute (3)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top"> 10. Dysarthria </td>
                                <td style="padding-left: 5px">
                                    <select name="no10" id="no10" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no10'])? ($nihss['no10'] == 0? "selected": "") : "" ?>>Normal articulation (0)</option>
                                        <option value="1" <?php echo isset($nihss['no10'])? ($nihss['no10'] == 1? "selected": "") : "" ?>>Mild to moderate (1)</option>
                                        <option value="2" <?php echo isset($nihss['no10'])? ($nihss['no10'] == 2? "selected": "") : "" ?>>Severe (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top"> 11. Neglect </td>
                                <td style="padding-left: 5px">
                                    <select name="no11" id="no11" onchange="onchange_nihss();" disabled>
                                        <option value="0" <?php echo isset($nihss['no11'])? ($nihss['no11'] == 0? "selected": "") : "" ?>>No neglect (0)</option>
                                        <option value="1" <?php echo isset($nihss['no11'])? ($nihss['no11'] == 1? "selected": "") : "" ?>>Sensory or visual (1)</option>
                                        <option value="2" <?php echo isset($nihss['no11'])? ($nihss['no11'] == 2? "selected": "") : "" ?>>Sensory & visual (2)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr bgcolor="#E4E4E4">
                                <td valign="top" align="right"><u>Total Score</u></td>
                                <td style="padding-left: 5px"><b>
                                    <div id="nihss_score">
                                   <?php                                    
                                        $no1a = isset($nihss['no1a'])? $nihss['no1a'] : 0;
                                        $no1b = isset($nihss['no1b'])? $nihss['no1b'] : 0;
                                        $no1c = isset($nihss['no1c'])? $nihss['no1c'] : 0;
                                        $no2 = isset($nihss['no2'])? $nihss['no2'] : 0;
                                        $no3 = isset($nihss['no3'])? $nihss['no3'] : 0;
                                        $no4 = isset($nihss['no4'])? $nihss['no4'] : 0;
                                        $no5a = isset($nihss['no5a'])? $nihss['no5a'] : 0;
                                        $no5b = isset($nihss['no5b'])? $nihss['no5b'] : 0;
                                        $no6a = isset($nihss['no6a'])? $nihss['no6a'] : 0;
                                        $no6b = isset($nihss['no6b'])? $nihss['no6b'] : 0;
                                        $no7 = isset($nihss['no7'])? $nihss['no7'] : 0;
                                        $no8 = isset($nihss['no8'])? $nihss['no8'] : 0;
                                        $no9 = isset($nihss['no9'])? $nihss['no9'] : 0;
                                        $no10 = isset($nihss['no4'])? $nihss['no10'] : 0;
                                        $no11 = isset($nihss['no4'])? $nihss['no11'] : 0;
                                        $score = $no1a + $no1b + $no1c + $no2 + $no3 + $no4 + $no5a + $no5b + $no6a + $no6b + $no7 + $no8 + $no9 + $no10 + $no11;
                                        echo $score;
                                   ?>
                                   </div></b>
                                </td>
                            </tr>
                            <tr><td colspan="3" align="center"><a href="#" id="next-1" name="next-1">Next</a></td></tr>
                        </table>
                    </div>

                    <div id="tabs-2">
                        <table id="users" class="ui-widget ui-widget-content ui-corner-all" width="100%" style="margin-top: 10px;padding-bottom: 10px;">
                            <thead>
                                <tr class="ui-widget-header ">
                                    <th colspan="7" align="left" style="padding: 10px">Stroke Data</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="2">
                                        <table width="100%"><tr>
                                                <td>วันที่ </td><td align="left"><u><?php                                                
                                                echo date("Y-m-d");
                                                ?></u></td><td align="left">ชื่อ </td><td><u><?php echo $patient['p_fname']." ".$patient['p_lname']  ?></u></td><td></td><td></td>
                                            </tr></table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <table width="100%">
                                            <tr>
                                                <td width="100">อายุ <?php echo date("Y")-strftime("%Y",strtotime($patient['p_bday']));?> ปี</td>
                                                <td>วันเดือนปีเกิด :  <?php echo $patient['p_bday'];?></td><td></td>
                                            </tr>                                            
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <table style="border:solid gray 1px">
                                            <tr>
                                                <td rowspan="2" width="150">เวลาที่เกิดอาการ </td>
                                                <td>
                                                    <input type="radio" id="strokeTimeYN" name="strokeTimeYN" value="yes" <?php echo isset($std['strokeTimeYN'])? ($std['strokeTimeYN'] == "yes"? "checked": "") : "" ?>> ทราบ
                                                    HH<input type="text" name="strokeTimeHour" id="strokeTimeHour" size="2" value="<?php echo isset($std['strokeTimeHour'])? $std['strokeTimeHour']:"00" ?>" onchange="calStrokeTime();">:
                                                    MM<input type="text" name="strokeTimeMinute" id="strokeTimeMinute" size="2" value="<?php echo isset($std['strokeTimeMinute'])? $std['strokeTimeMinute']:"00" ?>" onchange="calStrokeTime();" onchange="calStrokeTime();">
                                                    วันที่
                                                    <input type="text" name="strokeTimeDMY" id="strokeTimeDMY" size="10" value="<?php echo date("Y-m-d")?>">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td><input type="radio" id="strokeTimeYN" name="strokeTimeYN" value="no" <?php echo isset($std['strokeTimeYN'])? ($std['strokeTimeYN'] == "no"? "checked": "") : "" ?>> ไม่ทราบ</td>
                                            </tr>
                                        </table>                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <table style="border:solid gray 1px">
                                            <tr>
                                                <td rowspan="2" width="150">เวลาสุดท้ายที่ปกติ </td>
                                                <td>
                                                    <input type="radio" id="strokeNormalTimeYN" name="strokeNormalTimeYN" value="yes" <?php echo isset($std['strokeNormalTimeYN'])? ($std['strokeNormalTimeYN'] == "yes"? "checked": "") : "" ?>> ทราบ
                                                    HH<input type="text" name="strokeNormalTimeHour" id="strokeNormalTimeHour" size="2" value="<?php echo isset($std['strokeNormalTimeHour'])? $std['strokeNormalTimeHour']:"00" ?>">:
                                                    MM<input type="text" name="strokeNormalTimeMinute" id="strokeNormalTimeMinute" size="2" value="<?php echo isset($std['strokeNormalTimeMinute'])? $std['strokeNormalTimeMinute']:"00" ?>">
                                                    วันที่
                                                    <input type="text" name="strokeNormalTimeDMY" id="strokeNormalTimeDMY" size="10" value="<?php echo date("Y-m-d")?>">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td><input type="radio" id="strokeNormalTimeYN" name="strokeNormalTimeYN" value="no" <?php echo isset($std['strokeNormalTimeYN'])? ($std['strokeNormalTimeYN'] == "no"? "checked": "") : "" ?>> ไม่ทราบ</td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <table>
                                            <tr>
                                                <td width="120">เหลือเวลาอีก</td>
                                                <td width="40" align="center"><div style="color: red;" id="strokeLeftHour"></div> </td><td>ชั่วโมง</td>
                                                <td width="40" align="center"> <div style="color: red;" id="strokeLeftMinute"></div></td><td>นาที</td>
                                            </tr>
                                        </table>
                                </tr>
                                <tr>
                                    <td>
                                        CC:
                                    </td>
                                    <td><input type="text" size="70" id="cc" name="cc" value="<?php echo isset($std['cc'])? $std['cc']:"" ?>"></td>
                                </tr>
                                <tr>
                                    <td>
                                        PI:
                                    </td>
                                    <td>
                                        <textarea cols="70" rows="3" id="PI" name="PI"><?php echo isset($std['PI'])?$std['PI']:"" ?></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <!--
                                        <table style="margin-left: 5px">
                                            <tr><td width="100">Headache</td><td><input id="headache" name="headache" type="radio" value="yes" <?php echo isset($std['headache'])? ($std['headache'] == "yes"? "checked": "") : "" ?>>Yes</td><td><input id="headache" name="headache" type="radio" value="no" <?php echo isset($std['headache'])? ($std['headache'] == "no"? "checked": "") : "" ?>>No</td><td></td><td></td></tr>
                                            <tr><td width="100"></td><td>ข้างที่ปวดรุนแรง</td><td><input id="sideheadache" name="sideheadache" type="radio" value="l" <?php echo isset($std['sideheadache'])? ($std['sideheadache'] == "l"? "checked": "") : "" ?>>Left</td><td><input id="sideheadache" name="sideheadache" type="radio" value="r" <?php echo isset($std['sideheadache'])? ($std['sideheadache'] == "r"? "checked": "") : "" ?>>Right</td><td><input id="sideheadache" name="sideheadache" type="radio" value="b" <?php echo isset($std['sideheadache'])? ($std['sideheadache'] == "b"? "checked": "") : "" ?>>Bilateral</td></tr>
                                            <tr><td width="100"></td><td>ความรุนแรง</td><td><input id="muchheadache" name="muchheadache" type="radio" value="ml" <?php echo isset($std['muchheadache'])? ($std['muchheadache'] == "ml"? "checked": "") : "" ?>>Mild</td><td><input id="muchheadache" name="muchheadache" type="radio" value="mr" <?php echo isset($std['muchheadache'])? ($std['muchheadache'] == "mr"? "checked": "") : "" ?>>Moderate</td><td><input id="muchheadache" name="muchheadache" type="radio" value="s" <?php echo isset($std['muchheadache'])? ($std['muchheadache'] == "s"? "checked": "") : "" ?>>Severe</td></tr>
                                            <tr><td width="100"></td><td>ตำแหน่งการปวด</td><td><input id="areaheadache" name="areaheadache" type="radio" value="f" <?php echo isset($std['areaheadache'])? ($std['areaheadache'] == "f"? "checked": "") : "" ?>>หน้าฝาก</td><td><input id="areaheadache" name="areaheadache" type="radio" value="l" <?php echo isset($std['areaheadache'])? ($std['areaheadache'] == "l"? "checked": "") : "" ?>>ท้ายทอย</td><td><input id="areaheadache" name="areaheadache" type="radio" value="k" <?php echo isset($std['areaheadache'])? ($std['areaheadache'] == "k"? "checked": "") : "" ?>>ขมับ</td>
                                                <td><input id="areaheadache" name="areaheadache" type="radio" value="o" <?php echo isset($std['areaheadache'])? ($std['areaheadache'] == "o"? "checked": "") : "" ?>>อื่นๆ<input type="text" id="areaheadache_other" name="areaheadache_other" value="<?php echo isset($std['areaheadache_other'])? $std['areaheadache_other']:"" ?>"></td></tr>
                                        </table>-->
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top">
                                        PH:
                                    </td>
                                    <td>
                                        <table>
                                            <tr><td><table><tr><td><input type="checkbox" id="ph_ht_yn" name="ph_ht_yn" <?php echo isset($std['ph_ht_yn'])? ($std['ph_ht_yn'] == "true"? "checked": "") : "" ?>>HT</td><td>
                                                                <input type="text" id="ph_ht_yrs" name="ph_ht_yrs" size="3" value="<?php echo isset($std['ph_ht_yrs'])?$std['ph_ht_yrs']:"" ?>">Yrs.</td><td>Med</td><td>
                                                                <input id="ph_ht_med" name="ph_ht_med" type="text" size="15" value="<?php echo isset($std['ph_ht_med'])?$std['ph_ht_med']:"" ?>"></td>
                                                            <td><input type="checkbox" id="ph_dm_yn" name="ph_dm_yn" <?php echo isset($std['ph_dm_yn'])? ($std['ph_dm_yn'] == "true"? "checked": "") : "" ?>>DM</td><td>
                                                                <input type="text" id="ph_dm_yrs" name="ph_dm_yrs" size="3" value="<?php echo isset($std['ph_dm_yrs'])?$std['ph_dm_yrs']:"" ?>">Yrs.</td><td>Med</td><td>
                                                                <input type="text" id="ph_dm_med" name="ph_dm_med" size="15" value="<?php echo isset($std['ph_dm_med'])?$std['ph_dm_med']:"" ?>"></td></tr></table></td></tr>
                                            <tr><td><table><tr><td><input type="checkbox" id="ph_dyslipidemia_yn"  name="ph_dyslipidemia_yn" <?php echo isset($std['ph_dyslipidemia_yn'])? ($std['ph_dyslipidemia_yn'] == "true"? "checked": "") : "" ?>>Dyslipidemia</td><td>
                                                                <input type="text" size="3" id="ph_dyslipidemia_yrs" name="ph_dyslipidemia_yrs" value="<?php echo isset($std['ph_dyslipidemia_yrs'])?$std['ph_dyslipidemia_yrs']:"" ?>">Yrs.</td><td>Med</td><td>
                                                                <input type="text" size="15" id="ph_dyslipidemia_med" name="ph_dyslipidemia_med" value="<?php echo isset($std['ph_dyslipidemia_med'])?$std['ph_dyslipidemia_med']:"" ?>"></td></tr></table></td></tr>
                                            <tr><td><table><tr><td><input type="checkbox" id="ph_smoking_yn" name="ph_smoking_yn" <?php echo isset($std['ph_smoking_yn'])? ($std['ph_smoking_yn'] == "true"? "checked": "") : "" ?>>Smoking</td><td>
                                                                <input type="text" size="3" id="ph_smoking_pack" name="ph_smoking_pack" value="<?php echo isset($std['ph_smoking_pack'])?$std['ph_smoking_pack']:"" ?>">Packs/day</td><td>
                                                                <input type="text" size="3" id="ph_smoking_yrs" name="ph_smoking_yrs" value="<?php echo isset($std['ph_smoking_yrs'])?$std['ph_smoking_yrs']:"" ?>"></td><td>Yrs.</td><td>Quit</td><td>
                                                                <input type="text" size="3" id="ph_smoking_qyrs" name="ph_smoking_qyrs" value="<?php echo isset($std['ph_smoking_qyrs'])?$std['ph_smoking_qyrs']:"" ?>"></td><td>Yrs.</td></tr></table></td></tr>
                                            <tr><td><table><tr><td><input type="checkbox" id="ph_heart_disease_yn" name="ph_heart_disease_yn" <?php echo isset($std['ph_heart_disease_yn'])? ($std['ph_heart_disease_yn'] == "true"? "checked": "") : "" ?>>Heart disease type
                                                                <input type="text" size="15" id="ph_heart_disease_type" name="ph_heart_disease_type" value="<?php echo isset($std['ph_heart_disease_type'])?$std['ph_heart_disease_type']:"" ?>"></td><td>Med</td><td>
                                                                <input type="text" size="15" id="ph_heart_disease_med" name="ph_heart_disease_med" value="<?php echo isset($std['ph_heart_disease_med'])?$std['ph_heart_disease_med']:"" ?>"></td></tr></table></td></tr>
                                            <tr><td><table><tr><td><input type="checkbox" id="ph_stroke_yn" name="ph_stroke_yn" <?php echo isset($std['ph_stroke_yn'])? ($std['ph_stroke_yn'] == "true"? "checked": "") : "" ?>>Stroke
                                                                <input type="text" size="3" id="ph_stroke_year" name="ph_stroke_year" value="<?php echo isset($std['ph_stroke_year'])?$std['ph_stroke_year']:"" ?>"></td><td>Yrs.</td><td>
                                                                Type
                                                                <input type="radio" id="ph_stroke_type" name="ph_stroke_type" value="i" <?php echo isset($std['ph_stroke_type'])? ($std['ph_stroke_type'] == "i"? "checked": "") : "" ?>>ischemic
                                                                <input type="radio" id="ph_stroke_type" name="ph_stroke_type" value="ich" <?php echo isset($std['ph_stroke_type'])? ($std['ph_stroke_type'] == "ich"? "checked": "") : "" ?>>ICH
                                                                <input type="radio" id="ph_stroke_type" name="ph_stroke_type" value="sah" <?php echo isset($std['ph_stroke_type'])? ($std['ph_stroke_type'] == "sah"? "checked": "") : "" ?>>SAH
                                                            </td></tr></table></td></tr>

                                            <tr><td><table><tr><td><input type="checkbox" id="ph_others_yn" name="ph_others_yn" <?php echo isset($std['ph_others_yn'])? ($std['ph_others_yn'] == "true"? "checked": "") : "" ?>>Others</td><td>
                                                                <input type="text" size="25" id="ph_others" name="ph_others" value="<?php echo isset($std['ph_others'])?$std['ph_others']:"" ?>"></td></tr></table></td></tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td colspan="4" align="center"><a href="#" id="next-2" name="next-2">Next</a></td></tr>
                                <tr><td colspan="4" align="center"></td></tr>
                                
                            </tbody>
                        </table>
                    </div>

                    <div id="tabs-3">
                        <table id="users" class="ui-widget ui-widget-content ui-corner-all" width="102%" style="margin-top: 5px;padding-bottom: 10px;">
                            <thead>
                                <tr class="ui-widget-header ">
                                    <th colspan="7" align="left" style="padding: 10px">Stroke Physical examination</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr><td colspan="2">
                                        <table>
                                            <tr><td><b><u>BP</u></b>:
                                                    <input type="text" size="3" name="BPmax" id="BPmax" onchange="checkBP()" value="<?php echo isset($stp['BPmax'])?$stp['BPmax']:"" ?>">/
                                                    <input type="text" size="2" name="BPmin" id="BPmin" onchange="checkBP()" value="<?php echo isset($stp['BPmin'])?$stp['BPmin']:"" ?>">
                                                    
                                                    ,<b><u>PR</u></b> 
                                                    <input type="text" size="2" id="PR" name="PR" value="<?php echo isset($stp['PR'])?$stp['PR']:"" ?>"> /
                                                    min regular
                                                    <input type="radio" id="PRminYN" name="PRminYN" value="y" <?php echo isset($stp['PRminYN'])? ($stp['PRminYN'] == "y"? "checked": "") : "" ?>>Y/
                                                    <input type="radio" id="PRminYN" name="PRminYN" value="n" <?php echo isset($stp['PRminYN'])? ($stp['PRminYN'] == "n"? "checked": "") : "" ?>>N</td></tr>
                                            <tr><td colspan="2" style="padding-left: 5px"><b><u>Carotid bruit</u></b>
                                                    Lt: <input type="radio" id="CarotidLt" name="CarotidLt" value="y" <?php echo isset($stp['CarotidLt'])? ($stp['CarotidLt'] == "y"? "checked": "") : "" ?>>Y/
                                                    <input type="radio" id="CarotidLt" name="CarotidLt" value="n" <?php echo isset($stp['CarotidLt'])? ($stp['CarotidLt'] == "n"? "checked": "") : "" ?>>N
                                                    Rt: <input type="radio" id="CarotidRt" name="CarotidRt" value="y" <?php echo isset($stp['CarotidRt'])? ($stp['CarotidRt'] == "y"? "checked": "") : "" ?>>Y/
                                                    <input type="radio" id="CarotidRt" name="CarotidRt" value="n" <?php echo isset($stp['CarotidRt'])? ($stp['CarotidRt'] == "n"? "checked": "") : "" ?>>N</td></tr>
                                        </table>
                                    </td></tr>
                                <tr><td colspan="2"><b><u>Heart</u></b>:
                                        <input type="radio" id="HeartNA" name="HeartNA" value="n" <?php echo isset($stp['HeartNA'])? ($stp['HeartNA'] == "n"? "checked": "") : "" ?>> Normal /
                                        <input type="radio" id="HeartNA" name="HeartNA" value="a" <?php echo isset($stp['HeartNA'])? ($stp['HeartNA'] == "a"? "checked": "") : "" ?>> Abnormal
                                        <input type="text" size="30" id="Heart" name="Heart" value="<?php echo isset($stp['Heart'])?$stp['Heart']:"" ?>"></td></tr>
                                <tr><td colspan="2"><b><u>Consciousness</u></b>:
                                        E <input type="text" size="1" id="ConsciousnessE" name="ConsciousnessE" value="<?php echo isset($stp['ConsciousnessE'])?$stp['ConsciousnessE']:"" ?>">
                                        M <input type="text" size="1" id="ConsciousnessM" name="ConsciousnessM" value="<?php echo isset($stp['ConsciousnessM'])?$stp['ConsciousnessM']:"" ?>">
                                        V <input type="text" size="1" id="ConsciousnessV" name="ConsciousnessV" value="<?php echo isset($stp['ConsciousnessV'])?$stp['ConsciousnessV']:"" ?>"> </td></tr>
                                <tr><td colspan="2"><i><b>Orientation</b></i>:
                                        time <input type="text" size="5" id="OrientationTime" name="OrientationTime" value="<?php echo isset($stp['OrientationTime'])?$stp['OrientationTime']:"" ?>">
                                        place <input type="text" size="5" id="OrientationPlace" name="OrientationPlace" value="<?php echo isset($stp['OrientationPlace'])?$stp['OrientationPlace']:"" ?>">
                                        person <input type="text" size="5" id="OrientationPerson" name="OrientationPerson" value="<?php echo isset($stp['OrientationPerson'])?$stp['OrientationPerson']:"" ?>"></td></tr>
                                <tr><td colspan="2"><u><b>Speech</b></u>:
                                        <input type="radio" id="Speech" name="Speech" value="d" <?php echo isset($stp['Speech'])? ($stp['Speech'] == "d"? "checked": "") : "" ?>> dysarthric
                                        <input type="radio" id="Speech" name="Speech" value="a" <?php echo isset($stp['Speech'])? ($stp['Speech'] == "a"? "checked": "") : "" ?>> aphasic
                                        <input type="radio" id="Speech" name="Speech" value="n" <?php echo isset($stp['Speech'])? ($stp['Speech'] == "n"? "checked": "") : "" ?>> normal </td></tr>
                                <tr><td colspan="2"><i><b>Type of aphasia</b></i>:
                                        <input type="radio" id="Aphasia" name="Aphasia" value="m" <?php echo isset($stp['Aphasia'])? ($stp['Aphasia'] == "m"? "checked": "") : "" ?>> motor
                                        <input type="radio" id="Aphasia" name="Aphasia" value="s" <?php echo isset($stp['Aphasia'])? ($stp['Aphasia'] == "s"? "checked": "") : "" ?>> sensory
                                        <input type="radio" id="Aphasia" name="Aphasia" value="g" <?php echo isset($stp['Aphasia'])? ($stp['Aphasia'] == "g"? "checked": "") : "" ?>> global</td></tr>
                                <tr><td><i><b>Fluency</b></i>:
                                        <input type="radio" id="Fluency" name="Fluency" value="n" <?php echo isset($stp['Fluency'])? ($stp['Fluency'] == "n"? "checked": "") : "" ?>> Normal
                                        <input type="radio" id="Fluency" name="Fluency" value="a" <?php echo isset($stp['Fluency'])? ($stp['Fluency'] == "a"? "checked": "") : "" ?>> Abnormal </td>
                                    <td><i><b>Comprehension</b></i>:
                                        <input type="radio" id="Comprehension" name="Comprehension" value="n" <?php echo isset($stp['Comprehension'])? ($stp['Comprehension'] == "n"? "checked": "") : "" ?>>Normal
                                        <input type="radio" id="Comprehension" name="Comprehension" value="a" <?php echo isset($stp['Comprehension'])? ($stp['Comprehension'] == "a"? "checked": "") : "" ?>>Abnormal </td></tr>
                                <tr><td><i><b>Paraphasia</b></i>:
                                        <input type="radio" id="Paraphasia" name="Paraphasia" value="n" <?php echo isset($stp['Paraphasia'])? ($stp['Paraphasia'] == "n"? "checked": "") : "" ?>>Normal
                                        <input type="radio" id="Paraphasia" name="Paraphasia" value="a" <?php echo isset($stp['Paraphasia'])? ($stp['Paraphasia'] == "a"? "checked": "") : "" ?>>Abnormal </td><td>
                                        <i><b>Repetition</b></i>:
                                        <input type="radio" id="Repetition" name="Repetition" value="n" <?php echo isset($stp['Repetition'])? ($stp['Repetition'] == "n"? "checked": "") : "" ?>>Normal
                                        <input type="radio" id="Repetition" name="Repetition" value="a" <?php echo isset($stp['Repetition'])? ($stp['Repetition'] == "a"? "checked": "") : "" ?>>Abnormal </td></tr>
                                <tr><td><i><b>Naming</b></i>:
                                        <input type="radio" id="Naming" name="Naming" value="n" <?php echo isset($stp['Naming'])? ($stp['Naming'] == "n"? "checked": "") : "" ?>>Normal
                                        <input type="radio" id="Naming" name="Naming" value="a" <?php echo isset($stp['Naming'])? ($stp['Naming'] == "a"? "checked": "") : "" ?>>Abnormal  </td></tr>
                                <tr><td colspan="2"> <b><u>Cranial nerves</u></b>:
                                        Eye deviation in primary position
                                        L: <input type="text" size="5" id="CranialL" name="CranialL" value="<?php echo isset($stp['CranialL'])?$stp['CranialL']:"" ?>">
                                        R: <input type="text" size="5" id="CranialR" name="CranialR" value="<?php echo isset($stp['CranialR'])?$stp['CranialR']:"" ?>"></td></tr>
                                <tr><td colspan="2">
                                        <b><u>Horner's syndrome</u></b>:
                                        <input type="radio" id="Horner" name="Horner" value="-" <?php echo isset($stp['Horner'])? ($stp['Horner'] == "-"? "checked": "") : "" ?>>-/
                                        <input type="radio" id="Horner" name="Horner" value="+" <?php echo isset($stp['Horner'])? ($stp['Horner'] == "+"? "checked": "") : "" ?>>+
                                        (
                                        <input type="radio" id="HornerLR" name="HornerLR" value="r" <?php echo isset($stp['HornerLR'])? ($stp['HornerLR'] == "r"? "checked": "") : "" ?>>Rt,
                                        <input type="radio" id="HornerLR" name="HornerLR" value="l" <?php echo isset($stp['HornerLR'])? ($stp['HornerLR'] == "l"? "checked": "") : "" ?>>Lt)
                                        </td></tr>
                                <tr><td colspan="2">
                                        <table>
                                            <tr>
                                                <td><i><b>Pupils</b></i>:</td><td>
                                                    Lt <input type="text" size="4" id="PupilsLt" name="PupilsLt" value="<?php echo isset($stp['PupilsLt'])?$stp['PupilsLt']:"" ?>"> mm.
                                                    <input type="radio" id="PupilsLtc" name="PupilsLtc" value="g" <?php echo isset($stp['PupilsLtc'])? ($stp['PupilsLtc'] == "g"? "checked": "") : "" ?>>good
                                                    <input type="radio" id="PupilsLtc" name="PupilsLtc" value="s" <?php echo isset($stp['PupilsLtc'])? ($stp['PupilsLtc'] == "s"? "checked": "") : "" ?>>sluggish
                                                    <input type="radio" id="PupilsLtc" name="PupilsLtc" value="n" <?php echo isset($stp['PupilsLtc'])? ($stp['PupilsLtc'] == "n"? "checked": "") : "" ?>>not reactive to light</td></tr>
                                            <tr><td></td><td>
                                                    Rt <input type="text" size="4" id="PupilsRt" name="PupilsRt" value="<?php echo isset($stp['PupilsRt'])?$stp['PupilsRt']:"" ?>"> mm.
                                                    <input type="radio" id="PupilsRtc" name="PupilsRtc" value="g" <?php echo isset($stp['PupilsRtc'])? ($stp['PupilsRtc'] == "g"? "checked": "") : "" ?>>good
                                                    <input type="radio" id="PupilsRtc" name="PupilsRtc" value="s" <?php echo isset($stp['PupilsRtc'])? ($stp['PupilsRtc'] == "s"? "checked": "") : "" ?>>sluggish
                                                    <input type="radio" id="PupilsRtc" name="PupilsRtc" value="n" <?php echo isset($stp['PupilsRtc'])? ($stp['PupilsRtc'] == "n"? "checked": "") : "" ?>>not reactive to light</td></tr>
                                        </table></td></tr>
                                <tr><td colspan="2"><b>VA</b>:
                                        Lt <input type="text" size="4" id="VALt" name="VALt" value="<?php echo isset($stp['VALt'])?$stp['VALt']:"" ?>">
                                        Rt <input type="text" size="4" id="VARt" name="VARt" value="<?php echo isset($stp['VARt'])?$stp['VARt']:"" ?>">
                                        <b>VF</b>:
                                        Lt <input type="text" size="4" id="VFLt" name="VFLt" value="<?php echo isset($stp['VFLt'])?$stp['VFLt']:"" ?>">
                                        Rt <input type="text" size="4" id="VFRt" name="VFRt" value="<?php echo isset($stp['VFRt'])?$stp['VFRt']:"" ?>"></td></tr>
                                <tr><td colspan="2"><i><b>Facial weakness</b></i>:
                                        <input type="radio" id="FacialWeaknessLR" name="FacialWeaknessLR" value="l" <?php echo isset($stp['FacialWeaknessLR'])? ($stp['FacialWeaknessLR'] == "l"? "checked": "") : "" ?>>Lt
                                        <input type="radio" id="FacialWeaknessLR" name="FacialWeaknessLR" value="r" <?php echo isset($stp['FacialWeaknessLR'])? ($stp['FacialWeaknessLR'] == "r"? "checked": "") : "" ?>>Rt,
                                        <input type="radio" id="FacialWeaknessUL" name="FacialWeaknessUL" value="u" <?php echo isset($stp['FacialWeaknessUL'])? ($stp['FacialWeaknessUL'] == "u"? "checked": "") : "" ?>>UMN
                                        <input type="radio" id="FacialWeaknessUL" name="FacialWeaknessUL" value="l" <?php echo isset($stp['FacialWeaknessUL'])? ($stp['FacialWeaknessUL'] == "l"? "checked": "") : "" ?>>LMN</td></tr>
                                <tr><td colspan="2"><i><b>Tongue deviation</b></i>:
                                        <input type="radio" id="TongueDeviationYN" name="TongueDeviationYN" value="y" <?php echo isset($stp['TongueDeviationYN'])? ($stp['TongueDeviationYN'] == "y"? "checked": "") : "" ?>> Y (
                                        to
                                        <input type="radio" id="TongueDeviationLR" name="TongueDeviationLR" value="l" <?php echo isset($stp['TongueDeviationLR'])? ($stp['TongueDeviationLR'] == "l"? "checked": "") : "" ?>>Lt/
                                        <input type="radio" id="TongueDeviationLR" name="TongueDeviationLR" value="r" <?php echo isset($stp['TongueDeviationLR'])? ($stp['TongueDeviationLR'] == "r"? "checked": "") : "" ?>>Rt)
                                        <input type="radio" id="TongueDeviationYN" name="TongueDeviationYN" value="n" <?php echo isset($stp['TongueDeviationYN'])? ($stp['TongueDeviationYN'] == "n"? "checked": "") : "" ?>>N
                                <tr><td colspan="2"><i><b>Gag reflex</b></i>:
                                        Lt <input type="text" size="3" id="GagReflexL" name="GagReflexL" value="<?php echo isset($stp['GagReflexL'])?$stp['GagReflexL']:"" ?>">/
                                        Rt <input type="text" size="3" id="GagReflexR" name="GagReflexR" value="<?php echo isset($stp['GagReflexR'])?$stp['GagReflexR']:"" ?>">
                                        Uvula:
                                        <input type="radio" id="UvalaMD" name="UvalaMD" value="m" <?php echo isset($stp['UvalaMD'])? ($stp['UvalaMD'] == "m"? "checked": "") : "" ?>> midline /
                                        <input type="radio" id="UvalaMD" name="UvalaMD" value="d" <?php echo isset($stp['UvalaMD'])? ($stp['UvalaMD'] == "d"? "checked": "") : "" ?>> deviate to
                                        <input type="radio" id="UvalaLR" name="UvalaLR" value="l" <?php echo isset($stp['UvalaLR'])? ($stp['UvalaLR'] == "l"? "checked": "") : "" ?>> Lt /
                                        <input type="radio" id="UvalaLR" name="UvalaLR" value="r" <?php echo isset($stp['UvalaLR'])? ($stp['UvalaLR'] == "r"? "checked": "") : "" ?>>Rt</td></tr>
                                <tr><td colspan="2">
                                        <table cellspacing="0" style="margin: 10px">
                                            <tr><td width="80"><u><b>Motor</b></u>:</td><td style="border-right: 2px solid black">
                                                    prox. <input type="text" size="1" id="MotorLTp" name="MotorLTp" value="<?php echo isset($stp['MotorLTp'])?$stp['MotorLTp']:"" ?>">/
                                                    distal <input type="text" size="1" id="MotorLTd" name="MotorLTd" value="<?php echo isset($stp['MotorLTd'])?$stp['MotorLTd']:"" ?>"> &nbsp;</td><td style="border-right: black 2px">
                                                    prox. <input type="text" size="1" id="MotorRTp" name="MotorRTp" value="<?php echo isset($stp['MotorRTp'])?$stp['MotorRTp']:"" ?>">/
                                                    distal <input type="text" size="1" id="MotorRTd" name="MotorRTd" value="<?php echo isset($stp['MotorRTd'])?$stp['MotorRTd']:"" ?>"></td></tr>
                                            <tr><td></td><td style="border-right: 2px solid black;border-top: 2px solid black">
                                                    prox. <input type="text" size="1" id="MotorLBp" name="MotorLBp" value="<?php echo isset($stp['MotorLBp'])?$stp['MotorLBp']:"" ?>">/
                                                    distal <input type="text" size="1" id="MotorLBd" name="MotorLBd" value="<?php echo isset($stp['MotorLBd'])?$stp['MotorLBd']:"" ?>"></td><td style="border-top: 2px solid black">
                                                    prox. <input type="text" size="1" id="MotorRBp" name="MotorRBp" value="<?php echo isset($stp['MotorRBp'])?$stp['MotorRBp']:"" ?>">/
                                                    distal <input type="text" size="1" id="MotorRBd" name="MotorRBd" value="<?php echo isset($stp['MotorRBd'])?$stp['MotorRBd']:"" ?>"></td></tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td colspan="2"><i><b>Pronator drifting</b></i>:
                                        <input type="radio" id="PronatorDriftingLR" name="PronatorDriftingLR" value="l" <?php echo isset($stp['PronatorDriftingLR'])? ($stp['PronatorDriftingLR'] == "l"? "checked": "") : "" ?>>Lt/
                                        <input type="radio" id="PronatorDriftingLR" name="PronatorDriftingLR" value="r" <?php echo isset($stp['PronatorDriftingLR'])? ($stp['PronatorDriftingLR'] == "r"? "checked": "") : "" ?>>Rt</td></tr>
                                <tr><td colspan="2"><u><b>Cerebellar signs</b></u>:
                                        <input type="radio" id="CerebellarYN" name="CerebellarYN" value="y" <?php echo isset($stp['CerebellarYN'])? ($stp['CerebellarYN'] == "y"? "checked": "") : "" ?>>Y/
                                        <input type="radio" id="CerebellarYN" name="CerebellarYN" value="n" <?php echo isset($stp['CerebellarYN'])? ($stp['CerebellarYN'] == "n"? "checked": "") : "" ?>>N
                                        Gait ataxia
                                        <input type="radio" id="CerebellarGLR" name="CerebellarGLR" value="l" <?php echo isset($stp['CerebellarGLR'])? ($stp['CerebellarGLR'] == "l"? "checked": "") : "" ?>>Lt/
                                        <input type="radio" id="CerebellarGLR" name="CerebellarGLR" value="r" <?php echo isset($stp['CerebellarGLR'])? ($stp['CerebellarGLR'] == "r"? "checked": "") : "" ?>>Rt,
                                        trunkal ataxia
                                        <input type="radio" id="CerebellarTYN" name="CerebellarTYN" value="y" <?php echo isset($stp['CerebellarTYN'])? ($stp['CerebellarTYN'] == "y"? "checked": "") : "" ?>>Y/
                                        <input type="radio" id="CerebellarTYN" name="CerebellarTYN" value="n" <?php echo isset($stp['CerebellarTYN'])? ($stp['CerebellarTYN'] == "n"? "checked": "") : "" ?>>N
                                        , finger to nose
                                        <input type="radio" id="CerebellarFYN" name="CerebellarFYN" value="y" <?php echo isset($stp['CerebellarFYN'])? ($stp['CerebellarFYN'] == "y"? "checked": "") : "" ?>>Y/
                                        <input type="radio" id="CerebellarFYN" name="CerebellarFYN" value="n" <?php echo isset($stp['CerebellarFYN'])? ($stp['CerebellarFYN'] == "n"? "checked": "") : "" ?>>N
                                    </td></tr>
                                <tr><td colspan="2">
                                        <table>
                                            <tr>
                                                <td valign="top" rowspan="3"><u><b>Sensory</b></u>:</td>
                                                <td>
                                                    <input type="radio" id="SensoryTMD" name="SensoryTMD" value="n" <?php echo isset($stp['SensoryTMD'])? ($stp['SensoryTMD'] == "n"? "checked": "") : "" ?> >Normal
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="radio" id="SensoryTMD" name="SensoryTMD" value="h" <?php echo isset($stp['SensoryTMD'])? ($stp['SensoryTMD'] == "h"? "checked": "") : "" ?> >Hemianesthenia 
                                                    <input type="radio" id="SensoryHlr" name="SensoryHlr" value="l" <?php echo isset($stp['SensoryHlr'])? ($stp['SensoryHlr'] == "l"? "checked": "") : "" ?>>Lt/
                                                    <input type="radio" id="SensoryHlr" name="SensoryHlr" value="r" <?php echo isset($stp['SensoryHlr'])? ($stp['SensoryHlr'] == "r"? "checked": "") : "" ?>>Rt
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="radio" id="SensoryTMD" name="SensoryTMD" value="p" <?php echo isset($stp['SensoryTMD'])? ($stp['SensoryTMD'] == "p"? "checked": "") : "" ?> >Parhal hemisensory loss
                                                    <input type="radio" id="SensoryPlr" name="SensoryPlr" value="l" <?php echo isset($stp['SensoryPlr'])? ($stp['SensoryPlr'] == "l"? "checked": "") : "" ?>>Lt/
                                                    <input type="radio" id="SensoryPlr" name="SensoryPlr" value="r" <?php echo isset($stp['SensoryPlr'])? ($stp['SensoryPlr'] == "r"? "checked": "") : "" ?>>Rt

                                                    <input type="text" id="SensoryP" name="SensoryP" value="<?php echo isset($stp['SensoryP'])?$stp['SensoryP']:"" ?>" size="8">
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td colspan="2">Neglect
                                        Lt <input type="radio" id="NeglectLt" name="NeglectLt" value="n" <?php echo isset($stp['NeglectLt'])?($stp['NeglectLt']=="n"?"checked":""):"" ?>> Normal /
                                           <input type="radio" id="NeglectLt" name="NeglectLt" value="a" <?php echo isset($stp['NeglectLt'])?($stp['NeglectLt']=="a"?"checked":""):"" ?>> Abnormal ,
                                        Rt <input type="radio" id="NeglectRt" name="NeglectRt" value="n" <?php echo isset($stp['NeglectRt'])?($stp['NeglectRt']=="n"?"checked":""):"" ?>> Normal /
                                           <input type="radio" id="NeglectRt" name="NeglectRt" value="a" <?php echo isset($stp['NeglectRt'])?($stp['NeglectRt']=="a"?"checked":""):"" ?>> Abnormal
                                           </td></tr>
                                <tr><td colspan="2">Proprioception
                                        Lt
                                           <input type="radio" id="ProprioceptionLt" name="ProprioceptionLt" value="n" <?php echo isset($stp['ProprioceptionLt'])?($stp['ProprioceptionLt']=="n"?"checked":""):"" ?>> Normal /
                                           <input type="radio" id="ProprioceptionLt" name="ProprioceptionLt" value="a" <?php echo isset($stp['ProprioceptionLt'])?($stp['ProprioceptionLt']=="a"?"checked":""):"" ?>> Abnormal,
                                        Rt 
                                           <input type="radio" id="ProprioceptionRt" name="ProprioceptionRt" value="n" <?php echo isset($stp['ProprioceptionRt'])?($stp['ProprioceptionRt']=="n"?"checked":""):"" ?>> Normal /
                                           <input type="radio" id="ProprioceptionRt" name="ProprioceptionRt" value="a" <?php echo isset($stp['ProprioceptionRt'])?($stp['ProprioceptionRt']=="a"?"checked":""):"" ?>> Abnormal
                                         </td></tr>

                                <tr><td colspan="2">
                                        <table style="margin: 10px; border: 1px solid black; padding: 5px" width="90%">
                                            <tr><td width="100">
                                                    <u><b>Final Dx</b></u></td><td><input type="radio" id="FinalDXHI" name="FinalDXHI" value="i" <?php echo isset($stp['FinalDXHI'])? ($stp['FinalDXHI'] == "i"? "checked": "") : "" ?>><b>Ischemic stoke </b></td></tr>
                                            <tr><td></td><td>
                                                    <input type="radio" id="FinalDXHI" name="FinalDXHI" value="h" <?php echo isset($stp['FinalDXHI'])? ($stp['FinalDXHI'] == "h"? "checked": "") : "" ?>><b>Hemorrhagic stoke </b> 
                                                    type <input type="text" size="5" id="FinalDXHType" name="FinalDXHType" value="<?php echo isset($stp['FinalDXHType'])?$stp['FinalDXHType']:"" ?>"> </td></tr>
                                            
                                            <tr><td><b>Vessel</b></td><td>
                                                    <input type="radio" id="VesselAP" name="VesselAP" value="a" <?php echo isset($stp['VesselAP'])? ($stp['VesselAP'] == "a"? "checked": "") : "" ?>><b>Anterior circulation :
                                                        <input type="radio" id="VesselAc" name="VesselAc" value="a" <?php echo isset($stp['VesselAc'])? ($stp['VesselAc'] == "a"? "checked": "") : "" ?>> ACA /
                                                        <input type="radio" id="VesselAc" name="VesselAc" value="m" <?php echo isset($stp['VesselAc'])? ($stp['VesselAc'] == "m"? "checked": "") : "" ?>> MCA </b></td></tr>
                                            <tr><td></td><td>
                                                    <input type="radio" id="VesselAP" name="VesselAP" value="p" <?php echo isset($stp['VesselAP'])? ($stp['VesselAP'] == "p"? "checked": "") : "" ?>><b>Posterior circulation: <br> &nbsp;&nbsp;&nbsp;&nbsp;
                                                        <input type="radio" id="VesselPc" name="VesselPc" value="pc" <?php echo isset($stp['VesselPc'])? ($stp['VesselPc'] == "pc"? "checked": "") : "" ?>> PCA /
                                                        <input type="radio" id="VesselPc" name="VesselPc" value="vb" <?php echo isset($stp['VesselPc'])? ($stp['VesselPc'] == "vb"? "checked": "") : "" ?>> VB /
                                                        <input type="radio" id="VesselPc" name="VesselPc" value="pi" <?php echo isset($stp['VesselPc'])? ($stp['VesselPc'] == "pi"? "checked": "") : "" ?>> PICA /
                                                        <input type="radio" id="VesselPc" name="VesselPc" value="ai" <?php echo isset($stp['VesselPc'])? ($stp['VesselPc'] == "ai"? "checked": "") : "" ?>> AICA /
                                                        <input type="radio" id="VesselPc" name="VesselPc" value="ce" <?php echo isset($stp['VesselPc'])? ($stp['VesselPc'] == "ce"? "checked": "") : "" ?>> Cerebellar </b></td></tr>
                                            <tr><td><b>Cause</b></td><td>
                                                    <input type="radio" id="Cause" name="Cause" value="e" <?php echo isset($stp['Cause'])? ($stp['Cause'] == "e"? "checked": "") : "" ?>><b>Emboli :
                                                        <input type="radio" id="CauseE" name="CauseE" value="c" <?php echo isset($stp['CauseE'])? ($stp['CauseE'] == "c"? "checked": "") : "" ?>> cardiac ,
                                                        <input type="radio" id="CauseE" name="CauseE" value="a" <?php echo isset($stp['CauseE'])? ($stp['CauseE'] == "a"? "checked": "") : "" ?>> artery ,
                                                        <input type="radio" id="CauseE" name="CauseE" value="u" <?php echo isset($stp['CauseE'])? ($stp['CauseE'] == "u"? "checked": "") : "" ?>> unknown </b></td></tr>
                                            <tr><td></td><td>
                                                    <input type="radio" id="Cause" name="Cause" value="t" <?php echo isset($stp['Cause'])? ($stp['Cause'] == "t"? "checked": "") : "" ?>><b>Thrombosis</b></td></tr>
                                            <tr><td></td><td>
                                                    <input type="radio" id="Cause" name="Cause" value="l" <?php echo isset($stp['Cause'])? ($stp['Cause'] == "l"? "checked": "") : "" ?>><b>Lacunar stroke :
                                                        type
                                                        <select name="CauseLType" id="CauseLType">
                                                            <option value="pm" <?php echo isset($stp['CauseLType'])? ($stp['CauseLType'] == "pm"? "selected": "") : "" ?>>Pure motor syndrome</option>
                                                            <option value="ps" <?php echo isset($stp['CauseLType'])? ($stp['CauseLType'] == "ps"? "selected": "") : "" ?>>Pure sensory syndrome</option>
                                                            <option value="ah" <?php echo isset($stp['CauseLType'])? ($stp['CauseLType'] == "ah"? "selected": "") : "" ?>>Ataxic hemiparesis</option>
                                                            <option value="dc" <?php echo isset($stp['CauseLType'])? ($stp['CauseLType'] == "dc"? "selected": "") : "" ?>>dysarthria clumsy hand syndrome</option>
                                                            <option value="sm" <?php echo isset($stp['CauseLType'])? ($stp['CauseLType'] == "sm"? "selected": "") : "" ?>>Sensori-motor syndrome</option>
                                                        </select></b></td></tr>
                                            <tr><td></td><td>
                                                    <input type="radio" id="Cause" name="Cause" value="o" <?php echo isset($stp['Cause'])? ($stp['Cause'] == "o"? "checked": "") : "" ?>><b>Others
                                                        <input type="text" size="15" id="CauseOther" name="CauseOther" value="<?php echo isset($stp['CauseOther'])?$stp['CauseOther']:"" ?>"></b></td></tr>
                                            <tr><td colspan="3"><b>Stage</b> :
                                                    <input type="radio" id="Stage" name="Stage" value="s" <?php echo isset($stp['Stage'])? ($stp['Stage'] == "s"? "checked": "") : "" ?>> Stable/
                                                    <input type="radio" id="Stage" name="Stage" value="p" <?php echo isset($stp['Stage'])? ($stp['Stage'] == "p"? "checked": "") : "" ?>> progressive/
                                                    <input type="radio" id="Stage" name="Stage" value="c" <?php echo isset($stp['Stage'])? ($stp['Stage'] == "c"? "checked": "") : "" ?>> completed/
                                                    <input type="radio" id="Stage" name="Stage" value="i" <?php echo isset($stp['Stage'])? ($stp['Stage'] == "i"? "checked": "") : "" ?>> improved/
                                                    <input type="radio" id="Stage" name="Stage" value="t" <?php echo isset($stp['Stage'])? ($stp['Stage'] == "t"? "checked": "") : "" ?>> TIA</td></tr>
                                        </table>
                                    </td></tr>
                                <tr><td colspan="2"><b>Other</b>
                                        <input type="text" size="40" id="stp_others" name="stp_others" value="<?php echo isset($stp['stp_others'])?$stp['stp_others']:"" ?>"> </td></tr>
                                <tr><td colspan="2"><b>Provisional Diagnosis</b>
                                        <input type="text" size="40" id="ProvisionalDiagnosis" name="ProvisionalDiagnosis" value="<?php echo isset($stp['ProvisionalDiagnosis'])?$stp['ProvisionalDiagnosis']:"" ?>"> </td></tr>                               
                                 <tr><td colspan="4" align="center"><a href="#" id="next-3" name="next-3">Next</a></td></tr>
                            </tbody>
                        </table>
                    </div>

                    <div id="tabs-4">
                        <table id="users" class="ui-widget ui-widget-content ui-corner-all" width="100%" style="margin-top: 10px;padding-bottom: 10px;">
                            <thead>
                                <tr class="ui-widget-header ">
                                    <th colspan="7" align="left" style="padding: 10px">Laboratory screen for exclusion</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr><td>
                                        <table style="width: 100%;border: solid 1px silver">
                                            <tr>
                                                <td valign="middle" align="center">
                                                    <iframe src="<?php url::base()?>ctscan?c_id=<?php echo $c_id?>&p_id=<?php echo $p_id?>" frameborder="0" width="100%" style="height:330px"></iframe>
                                                </td>
                                            </tr>
                                        </table>
                                    </td></tr>
                                <tr><td><input type="checkbox" id="CTscanYN"name="CTscanYN" <?php echo isset($lab['CTscanYN'])? ($lab['CTscanYN'] == "true"? "checked": "") : "" ?>>CT scan                                        </td></tr>
                                <tr><td>&nbsp;&nbsp;
                                        <input type="checkbox" id="CTNoICHYN" name="CTNoICHYN" <?php echo isset($lab['CTNoICHYN'])? ($lab['CTNoICHYN'] == "true"? "checked": "") : "" ?>> No ICH
                                        <input type="checkbox" id="CTnobrainYN" name="CTnobrainYN" <?php echo isset($lab['CTnobrainYN'])? ($lab['CTnobrainYN'] == "true"? "checked": "") : "" ?>> no brain edema/shiffing </td></tr>
                                <!--<tr><td><input type="checkbox" id="CTPerfusionYN" name="CTPerfusionYN" <?php echo isset($lab['CTPerfusionYN'])? ($lab['CTPerfusionYN'] == "true"? "checked": "") : "" ?>> Phinal</td></tr>-->
                                <tr><td><input type="checkbox" id="MRIYN" name="MRIYN" <?php echo isset($lab['MRIYN'])? ($lab['MRIYN'] == "true"? "checked": "") : "" ?>>
                                        MRI result <input type="text" size="5" id="MRIResult" name="MRIResult" value="<?php echo isset($lab['MRIResult'])?$lab['MRIResult']:"" ?>"> </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRINoICHYN" name="MRINoICHYN" <?php echo isset($lab['MRINoICHYN'])? ($lab['MRINoICHYN'] == "true"? "checked": "") : "" ?>> No ICH
                                        <input type="checkbox" id="MRInobrainYN" name="MRInobrainYN" <?php echo isset($lab['MRInobrainYN'])? ($lab['MRInobrainYN'] == "true"? "checked": "") : "" ?>> no brain edema/shiffing </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRIDWI30YN" name="MRIDWI30YN" <?php echo isset($lab['MRIDWI30YN'])? ($lab['MRIDWI30YN'] == "true"? "checked": "") : "" ?>> DWI &le; 30% of MCA territory </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRIDWIPWIYN" name="MRIDWIPWIYN" <?php echo isset($lab['MRIDWIPWIYN'])? ($lab['MRIDWIPWIYN'] == "true"? "checked": "") : "" ?>> DWI / PWI mismatch </td></tr>
                                <tr><td><input type="checkbox" id="MRAYN" name="MRAYN" <?php echo isset($lab['MRAYN'])? ($lab['MRAYN'] == "true"? "checked": "") : "" ?>> MRA</td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRAMCAYN" name="MRAMCAYN" <?php echo isset($lab['MRAMCAYN'])? ($lab['MRAMCAYN'] == "true"? "checked": "") : "" ?>> MCA
                                        <input type="radio" value="s" id="MRAMCAso" name="MRAMCAso" <?php echo isset($lab['MRAMCAso'])? ($lab['MRAMCAso'] == "s"? "checked": "") : "" ?>> stenosis/
                                        <input type="radio" value="o" id="MRAMCAso" name="MRAMCAso" <?php echo isset($lab['MRAMCAso'])? ($lab['MRAMCAso'] == "o"? "checked": "") : "" ?>> occlusion </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRAACAYN" name="MRAACAYN" <?php echo isset($lab['MRAACAYN'])? ($lab['MRAACAYN'] == "true"? "checked": "") : "" ?>> ACA
                                        <input type="radio" value="s" id="MRAACAso" name="MRAACAso" <?php echo isset($lab['MRAACAso'])? ($lab['MRAACAso'] == "s"? "checked": "") : "" ?>> stenosis/
                                        <input type="radio" value="o" id="MRAACAso" name="MRAACAso" <?php echo isset($lab['MRAACAso'])? ($lab['MRAACAso'] == "o"? "checked": "") : "" ?>> occlusion </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRABAYN" name="MRABAYN" <?php echo isset($lab['MRABAYN'])? ($lab['MRABAYN'] == "true"? "checked": "") : "" ?>> BA
                                        <input type="radio" value="s" id="MRABAso" name="MRABAso" <?php echo isset($lab['MRABAso'])? ($lab['MRABAso'] == "s"? "checked": "") : "" ?>> stenosis/
                                        <input type="radio" value="o" id="MRABAso" name="MRABAso" <?php echo isset($lab['MRABAso'])? ($lab['MRABAso'] == "o"? "checked": "") : "" ?>> occlusion </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRAICAYN" name="MRAICAYN" <?php echo isset($lab['MRAICAYN'])? ($lab['MRAICAYN'] == "true"? "checked": "") : "" ?>> ICA
                                        <input type="radio" value="s" id="MRAICAso" name="MRAICAso" <?php echo isset($lab['MRAICAso'])? ($lab['MRAICAso'] == "s"? "checked": "") : "" ?>> stenosis/
                                        <input type="radio" value="o" id="MRAICAso" name="MRAICAso" <?php echo isset($lab['MRAICAso'])? ($lab['MRAICAso'] == "o"? "checked": "") : "" ?>> occlusion </td></tr>
                                <tr><td>&nbsp;&nbsp;<input type="checkbox" id="MRAotherYN" name="MRAotherYN" <?php echo isset($lab['MRAotherYN'])? ($lab['MRAotherYN'] == "true"? "checked": "") : "" ?>> other
                                        <input type="text" size="5" id="MRAother" name="MRAother" value="<?php echo isset($lab['MRAother'])?$lab['MRAother']:"" ?>"> </td></tr>
                                <tr><td><hr></td></tr>
                                <tr><td>Blood test result</td></tr>
                                <tr><td>
                                        PG <input type="text" size="3" id="BloodPG" onchange="checkPG()" name="BloodPG" value="<?php echo isset($lab['BloodPG'])?$lab['BloodPG']:"" ?>"> mg/dl
                                        PT <input type="text" size="3" id="BloodPT" name="BloodPT" value="<?php echo isset($lab['BloodPT'])?$lab['BloodPT']:"" ?>"> sec.
                                        PTT <input type="text" size="3" id="BloodPTT" name="BloodPTT" value="<?php echo isset($lab['BloodPTT'])?$lab['BloodPTT']:"" ?>"> sec.
                                        PLT <input type="text" size="3" id="BloodPLT" onchange="checkPLT()" name="BloodPLT" size="10" value="<?php echo isset($lab['BloodPLT'])?$lab['BloodPLT']:"" ?>"> /cumm.</td></tr>
                                <tr><td>
                                        <table style="margin-left: 20px">
                                            <tr><td width="400" id="td_BloodPGYN">
                                                    <input type="checkbox" id="BloodPGYN" name="BloodPGYN" <?php echo isset($lab['BloodPGYN'])? ($lab['BloodPGYN'] == "true"? "checked": "") : "" ?>> PG > 50 < 400 mg/dl</td>
                                                <td id="td_BloodPLTYN"><input type="checkbox" id="BloodPLTYN" name="BloodPLTYN" <?php echo isset($lab['BloodPLTYN'])? ($lab['BloodPLTYN'] == "true"? "checked": "") : "" ?>> PLT > 100,000</td></tr>
                                            <tr><td><input type="checkbox" id="BloodINRYN" name="BloodINRYN" <?php echo isset($lab['BloodINRYN'])? ($lab['BloodINRYN'] == "true"? "checked": "") : "" ?>> INR < 1.7 </td><td>
                                                    </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td colspan="4" align="center"><a href="#" id="next-4" name="next-4">Next</a></td></tr>
                            </tbody>
                        </table>
                    </div>
                    <div id="tabs-5">
                        <table width="100%" class="ui-widget ui-widget-content ui-corner-all">
                            <tr class="ui-widget-header ">
                                <td colspan="3">ข้อบ่งชี้</td>
                            </tr>
                            <tr><td><input type="checkbox" id="estimate_i1" onchange="checkEstimate('estimate_i1')" name="estimate_i1" <?php echo isset($est['estimate_i1'])? ($est['estimate_i1'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>1. มีอาการของสมองขาดเลือดภายใน 4.5 ชั่วโมง</td></tr>
                            <tr bgcolor="#E4E4E4"><td><input type="checkbox" onchange="checkEstimate('estimate_i2')" id="estimate_i2" <?php echo isset($est['estimate_i2'])? ($est['estimate_i2'] == "true"? "checked": "style='background-color:red;'") : "" ?> name="estimate_i2" ></td><td>2. มีความผิดปกติทางระบบประสาทที่ตรวจพบได้</td></tr>
                            <tr><td><input type="checkbox" id="estimate_i3" onchange="checkEstimate('estimate_i3')" name="estimate_i3" <?php echo isset($est['estimate_i3'])? ($est['estimate_i3'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>3. ผลการตรวจเอกซเรย์คอมพิวเตอร์สมองไม่พบว่ามีเลือดออกในเนื้อสมองหรือเลือดออกในชั้นใต้เยื่อหุ้มสมอง</td></tr>
                        </table>
                        <br>
                        <table width="100%" class="ui-widget ui-widget-content ui-corner-all" >
                            <tr class="ui-widget-header "><td colspan="3">ข้อห้าม</td></tr>

                            <tr><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d1')" id="estimate_d1" name="estimate_d1" <?php echo isset($est['estimate_d1'])? ($est['estimate_d1'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>1. มีประวัติเลือดออกในสมองมาก่อน</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d2')" id="estimate_d2" name="estimate_d2" <?php echo isset($est['estimate_d2'])? ($est['estimate_d2'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>2. มีประวัติบาดเจ็บที่ศีรษะรุนแรงภายใน 3 เดือน</td></tr>
                            <tr><td><input type="checkbox" onchange="checkEstimate('estimate_d3')" id="estimate_d3" name="estimate_d3" <?php echo isset($est['estimate_d3'])? ($est['estimate_d3'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>3. มีประวัติผ่าตัดใหญ่ภายใน 14 วัน</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d4')" id="estimate_d4" name="estimate_d4" <?php echo isset($est['estimate_d4'])? ($est['estimate_d4'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>4. มีเลือดออกในทางเดินอาหาร หรือทางเดินปัสสาวะภายใน 21 วัน</td></tr>
                            <tr><td><input type="checkbox" onchange="checkEstimate('estimate_d5')" id="estimate_d5" name="estimate_d5" <?php echo isset($est['estimate_d5'])? ($est['estimate_d5'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>5. ผู้ป่วยที่มีอาการทางระบบประสาทดีขึ้นเองอย่างมากในเวลาอันรวดเร็ว หรือมีอาการน้อยก่อให้เกิดความพิการที่ไม่รุนแรง เช่น ชา เล็กน้อยเพียงอย่างเดียว</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d6')" id="estimate_d6" name="estimate_d6" <?php echo isset($est['estimate_d6'])? ($est['estimate_d6'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>6. มีอาการชักแต่เริ่มแรก</td></tr>
                            <tr><td><input type="checkbox" onchange="checkEstimate('estimate_d7')" id="estimate_d7" name="estimate_d7" <?php echo isset($est['estimate_d7'])? ($est['estimate_d7'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>7. มีประวัติกล้ามเนื้อหัวใจขาดเลือดเฉียบพลันในช่วงเวลาอันใกล้</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d8')" id="estimate_d8" name="estimate_d8" <?php echo isset($est['estimate_d8'])? ($est['estimate_d8'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>8. ความดันโลหิตช่วงก่อนให้การรักษาสูงโดยความดันซิสโตลิคสูงกว่า 185 มม.ปรอทหรือความดันไดแอสโตลิคสูงกว่า 110 มม.ปรอท</td></tr>
                            <tr><td><input type="checkbox" onchange="checkEstimate('estimate_d9')" id="estimate_d9" name="estimate_d9" <?php echo isset($est['estimate_d9'])? ($est['estimate_d9'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>9. มีระดับน้ำตาลในเลือดต่ำกว่า 50 มก/ดล. หรือสูงกว่า 400 มก/ดล.</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d10')" id="estimate_d10" name="estimate_d10" <?php echo isset($est['estimate_d10'])? ($est['estimate_d10'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>10. มีปริมาณเกล็ดเลือดน้อยกว่า 100,000/mm3</td></tr>
                            <tr><td><input type="checkbox" onchange="checkEstimate('estimate_d11')" id="estimate_d11" name="estimate_d11" <?php echo isset($est['estimate_d11'])? ($est['estimate_d11'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>11. ได้รับยา heparin ภายใน 48 ชั่วโมงและมีค่า partial thromboplastin time(PTT) ผิดปกติ</td></tr>
                            <tr bgcolor="#E4E4E4"><td>
                                    <input type="checkbox" onchange="checkEstimate('estimate_d12')" id="estimate_d12" name="estimate_d12" <?php echo isset($est['estimate_d12'])? ($est['estimate_d12'] == "true"? "checked": "style='background-color:red;'") : "" ?>></td><td>12. ได้รับยาต้านการแข็งตัวของเลือดโดยมีค่า protrombin time(PT) มากกว่า 15 วินาที หรือมีค่า international normalized ratio (INR) มากกว่า 1.7 </td></tr>
                        </table>
                        <br>
                        <table width="100%" class="ui-widget ui-widget-content ui-corner-all" >
                            <tr class="ui-widget-header "><td colspan="3">อธิบายเหตุผล</td></tr>

                            <tr><td align="center">
                                    <textarea id="estimate_reason" name="estimate_reason" cols="80" rows="5"><?php echo isset($est['estimate_reason'])? $est['estimate_reason'] : "" ?></textarea>
                                </td></tr>
                            <tr><td colspan="4" align="center"><a href="#" id="next-5" name="next-5">Next</a></td></tr>
                        </table>
                    </div>
                    <div id="tabs-6">
                        <table class="ui-widget ui-widget-content ui-corner-all" width="90%">
                            <thead>
                                <tr class="ui-widget-header">
                                   <td>Management</td>
                                </tr>
                            </thead>
                            <tr>
                                <td><br>
                                    <u><b>Initial Management</b></u><br>
                                    <table width="500" align="left">                                        
                                        <tr><td width="10"></td><td><input type="checkbox" id="im_IVfluidYN" <?php echo isset($mng['im_IVfluidYN'])? ($mng['im_IVfluidYN'] == "true"? "checked": "") : "" ?>>IV fluid</td></tr>
                                        <tr><td></td><td><input type="checkbox" id="im_O2CanulaYN" <?php echo isset($mng['im_O2CanulaYN'])? ($mng['im_O2CanulaYN'] == "true"? "checked": "") : "" ?>>O2 Canula</td></tr>
                                        <tr><td></td><td><input type="checkbox" id="im_IntubationYN" <?php echo isset($mng['im_IntubationYN'])? ($mng['im_IntubationYN'] == "true"? "checked": "") : "" ?>>Intubation</td></tr>
                                        <tr><td></td><td><input type="checkbox" id="im_OtherYn" <?php echo isset($mng['im_OtherYn'])? ($mng['im_OtherYn'] == "true"? "checked": "") : "" ?>>Other <input id="im_OtherTxt" name="im_OtherTxt" type="text" value="<?php echo isset($mng['im_OtherTxt'])? $mng['im_OtherTxt'] : "" ?>"></td></tr>
                                    </table></td>
                            </tr>
                            <tr>
                                <td><br>
                                    <u><b>Suggented Management</b></u><br>                                    
                                    <table align="left" style="padding-left: 10px">
                                        <tr>
                                            <td>
                                                <table>
                                                    <tr>
                                                        <td><input disabled type="checkbox" id="sm_IVTYn" name="sm_IVTYn" <?php echo isset($mng['sm_IVTYn'])? ($mng['sm_IVTYn'] == "true"? "checked": "") : "" ?>>IV Thrombolysis เริ่มเวลา </td>
                                                        <td><div id="sm_IVTStartTime" ><?php echo isset($mng['sm_IVTStartTime'])? $mng['sm_IVTStartTime'] : "" ?></div></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <table>
                                                    <tr>
                                                        <td><input disabled type="checkbox" id="sm_NIVTYn" name="sm_NIVTYn" <?php echo isset($mng['sm_NIVTYn'])? ($mng['sm_NIVTYn'] == "true"? "checked": "") : "" ?>>No IV Thormbolysis เนื่องจาก</td>
                                                        <td><div id="sm_NIVTC"><?php echo isset($mng['sm_NIVTC'])? $mng['sm_NIVTC'] : "" ?></div></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr><td>
                                                <table>
                                                    <tr>
                                                        <td>
                                                            <input disabled type="checkbox" id="sm_OtherYN" name="sm_OtherYN" <?php echo isset($mng['sm_OtherYN'])? ($mng['sm_OtherYN'] == "true"? "checked": "") : "" ?>>Other
                                                        </td>
                                                        <td>
                                                            <div id="sm_OtherTxt"><?php echo isset($mng['sm_OtherTxt'])? $mng['sm_OtherTxt'] : "" ?></div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td></tr>
                                    </table>
                                    </td>
                            </tr>

                        </table>
                    </div>
                    <div id="tabs-7">
                        <table width="300" class="ui-widget ui-widget-content ui-corner-all">
                            <thead><tr class="ui-widget-header"><td colspan="3" align="center">
                                        <table><tr><td>
                                                    <?php echo  html::image('assets/icon/user_48.png',array('width' => '48', 'height' => '48')) ?>

                                                </td>
                                                <td align="center"  valign="middle">
                                                    ข้อมูลคนไข้</td></tr></table></td>
                                </tr>
                            </thead>
                            <tr><td width="150">ชื่อ</td><td><?php echo $patient['p_fname'] ?></td></tr>
                            <tr><td>นามสกุล</td><td><?php echo $patient['p_lname'] ?></td></tr>
                            <tr><td>เพศ</td><td><?php echo $patient['p_sex']==1?"ชาย":"หญิง" ?></td></tr>
                            <tr><td>วันเดือนปีเกิด</td><td><?php echo $patient['p_bday'] ?></td></tr>
                            <tr><td>ที่อยู่</td><td><?php echo $patient['p_address'] ?></td></tr>
                            <tr><td>เบอร์โทรศัพท์</td><td><?php echo $patient['p_phone'] ?></td></tr>
                        </table>
                    </div>
                </div>
                <table width="100%"><tr><td align="center" colspan="3"></td></tr></table>
            </td>
        </tr>
    </table>
</form>


<div id="dialog-confirm" title="สิ้นสุดการตรวจ" style="width: 120px;height: 200px">
    <p>
        <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
        คุณจะทำการสิ้นสุดการตรวจแล้วใช่หรือไม่</p>
</div>

